# from django.conf import settings
# from django.db.models.signals import post_save
# from django.dispatch import receiver
# from rest_framework.authtoken.models import Token
# from django.contrib.auth import get_user_model
# User = get_user_model()                                 #获取用户User
#
# #Django信号机制，类似Android广播
# @receiver(post_save, sender=User)       #是类型post_save，接收User的信号
# def create_auth_token(sender, instance=None, created=False, **kwargs):
#
#     if created:
#         # 如果是新建用户则才执行
#         password = instance.password                        #获取密码
#         instance.set_password(password)                     #加密
#         instance.save()                                     #保存
